package com.typhoon.spring_boot_demo1.service.impl;

import com.typhoon.spring_boot_demo1.dto.SearchResultDto;
import com.typhoon.spring_boot_demo1.request.Operator;
import com.typhoon.spring_boot_demo1.service.ISearch;

import java.util.List;
import java.util.concurrent.Callable;

/**
 * 并发执行线程
 */
public class SearchThread implements Callable<List<SearchResultDto>> {

    private String key;

    private Operator operator;

    private ISearch iSearch;

    public SearchThread(String key, Operator operator, ISearch iSearch) {
        this.key = key;
        this.operator = operator;
        this.iSearch = iSearch;
    }

    @Override
    public List<SearchResultDto> call() throws Exception {
        return this.iSearch.search(key,operator);
    }
}
